package com.xbts.system.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.validation.constraints.NotNull;
import com.xbts.common.annotation.Excel;
import com.xbts.common.utils.StringUtils;
import com.xbts.common.core.domain.BaseEntity;

/**
 * 数据字典对象对象 sei_data_dict
 *
 * @author xbts
 * @date 2023-09-11
 */
@Data
@ApiModel("数据字典对象对象")
@TableName("sei_data_dict")
public class SeiDataDict extends BaseEntity {

private static final long serialVersionUID=1L;

    /** id */
    @Excel(name = "id")
    @ApiModelProperty("id")
    @NotEmpty(message = "id不能为空")
    @TableId
    private String dataDictId;

    /** 字段名称 */
    @Excel(name = "字段名称")
    @ApiModelProperty("字段名称")
    @NotEmpty(message = "字段名称不能为空")
    private String dictName;

    @ApiModelProperty("详细内容")
    @TableField(exist = false)
    private String dictDetails;

    /** 父级id */
    @Excel(name = "父级id")
    @ApiModelProperty("父级id")
    private String parentId;

    @ApiModelProperty("父级id")
    @TableField(exist = false)
    private List<SeiDataDict> children = new ArrayList();


    public<T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> queryWrapper=new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotEmpty(dataDictId),"data_dict_id",dataDictId);
        queryWrapper.like(StringUtils.isNotEmpty(dictName),"dict_name",dictName);
        queryWrapper.like(StringUtils.isNotEmpty(parentId),"parent_id",parentId);
        queryWrapper.orderByDesc("create_time");
        return queryWrapper;
    }
}